<template>
  <div class="home">
    <div class="container" ref="container"></div>
    <div class="indicator" ref="indicator"></div>
  </div>
</template>

<script lang="ts" setup>
import { onMounted, onUnmounted, ref } from "vue";
import homeRenderer from "./homeRender";

// 创建一个 ref 来保存 DOM 元素的引用
const container = ref<HTMLDivElement | null>(null);
const indicator = ref<HTMLDivElement | null>(null);
let showBtn = ref(false);

onMounted(() => {
  if (container.value) {
    homeRenderer.setContainer(container.value);
  }
});

onUnmounted(() => {});
</script>

<style lang="less" scoped>
.home {
  position: relative;
  width: 100%;
  height: 100%;

  .left {
    position: absolute;
    top: 0px;
    left: 0px;
    width: 60px;
    bottom: 0px;
    background-color: #ffffff;
    padding-top: 20px;
    display: inline-block;
    vertical-align: top;
    text-align: center;
    box-sizing: border-box;

    overflow-y: auto;

    &::-webkit-scrollbar {
      width: 2px;
      height: 2px;
      background-color: rgba(0, 0, 0, 0);
    }

    &::-webkit-scrollbar-track {
      box-shadow: inset 0 0 6px rgba(0, 0, 0, 0);
      border-radius: 2px;
      background-color: rgba(0, 0, 0, 0);
    }

    &::-webkit-scrollbar-thumb {
      border-radius: 2px;
      box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.3);
      background-color: #1890ff;
    }

    .btn {
      border: 1px solid #000000;
      margin: 2px;
      border-radius: 4px;
      padding: 1px 2px;
      cursor: pointer;
      user-select: none;
    }

    .space {
      display: block;
      width: 100%;
      height: 0px;
      margin: 3px 0px;
      border-bottom: 1px solid #888888;
    }
  }

  .switch {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 1;
  }

  .container {
    vertical-align: top;
    display: inline-block;
    width: 100% !important;
    max-width: 100% !important;
    height: 100%;
  }

  .indicator {
    width: 50px;
    height: 50px;
    position: absolute;
    right: 0px;
    top: 0px;
    pointer-events: none;
  }
}
</style>
